//
//  LSZSpecificEmptyData.m
//  JKFuYinProject
//
//  Created by 九酷 on 2018/8/7.
//  Copyright © 2018年 LC. All rights reserved.
//

#import "LSZSpecificEmptyData.h"

@implementation LSZSpecificEmptyData

{
    UIImageView * imageViewKong;
    UIView * backView;
}
- (instancetype)init {
    self = [super init];
    if (self) {
        self.frame = [UIScreen mainScreen].bounds;
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(RemoveAllSubviewsDelete) name:@"RemoveAllSubviews" object:nil];//删除通知

        imageViewKong = [[UIImageView alloc]init];
        imageViewKong.image = [UIImage imageNamed:@"暂时没有数据"];
        [self addSubview:imageViewKong];

        if (ScreenWidth == 320) {
            //5
            imageViewKong.frame = CGRectMake((ScreenWidth-270)/2, (backView.frame.size.height-148)/2,270, 148.9);
        }else if(ScreenWidth == 375){
            // 6 7
            imageViewKong.frame = CGRectMake((ScreenWidth-300)/2,(backView.frame.size.height-148)/2,300 , 166.5);
        }else {
            //plus
            imageViewKong.frame = CGRectMake((ScreenWidth-330)/2,(backView.frame.size.height-148)/2,330 , 183.2);
        }
    }
    return self;
}
- (void)showWithView:(UIView *)view
{
    [view addSubview:self];
    backView = view;
    if (ScreenWidth == 320) {
        //5
        imageViewKong.frame = CGRectMake((ScreenWidth-270)/2, (backView.frame.size.height-148)/2,270, 148.9);
    }else if(ScreenWidth == 375){
        // 6 7
        imageViewKong.frame = CGRectMake((ScreenWidth-300)/2,(backView.frame.size.height-148)/2,300 , 166.5);
    }else {
        //plus
        imageViewKong.frame = CGRectMake((ScreenWidth-330)/2,(backView.frame.size.height-148)/2,330 , 183.2);
    }
}
-(void)RemoveAllSubviewsDelete
{
    [self removeFromSuperview];
}

@end
